package cn.itcast.service;

import cn.itcast.mapper.UserMapper;
import cn.itcast.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Random;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public User queryById(Long id) {
//        int time = new Random().nextInt(3500);
//        System.out.println("id: " + id + ", time = " + time);
//        try {
//            Thread.sleep(Long.valueOf(time));
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        return this.userMapper.selectByPrimaryKey(id);
    }
}